package controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import utils.AirTransportRepositoryManager;

public class PassengerController extends AbstractController {

	private AirTransportRepositoryManager repositoryManager;
	
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

		String jmbg = request.getParameter("jmbg");
		
		ModelAndView mav =  new ModelAndView();
		
		mav.addObject("passenger", repositoryManager.getPassengerByJMBG(jmbg));
		mav.addObject("flights", repositoryManager.getFlightsByPassenger(jmbg));
		
		return mav;
	}

	public AirTransportRepositoryManager getRepositoryManager() {
		return repositoryManager;
	}

	public void setRepositoryManager(AirTransportRepositoryManager repositoryManager) {
		this.repositoryManager = repositoryManager;
	}


	
}
